import json
import time
from selenium import webdriver
from selenium.webdriver.common.by import By

driver = webdriver.Edge()
driver.get('http://192.168.8.222/')
driver.implicitly_wait(10)
driver.maximize_window()
# 点击登录按钮
driver.find_element(By.LINK_TEXT, "登录").click()
# 输入用户输入用户
driver.find_element(By.XPATH,"/html/body/div[4]/div/div[2]/div[2]/form/div[1]/input").send_keys("13012345678")
# 输入密码
driver.find_element(By.XPATH,"/html/body/div[4]/div/div[2]/div[2]/form/div[2]/input").send_keys("123456")
time.sleep(10)
# 点击登录按钮
driver.find_element(By.XPATH,'/html/body/div[4]/div/div[2]/div[2]/form/div[4]/button').click()
time.sleep(5)

# 得到cookies并存入到../data/l_front_end_cookies中
cookies = driver.get_cookies()
with open('../data/l_front_end_cookies.json','w',encoding='utf-8') as f:
    json.dump(cookies,f)

